<?php

/**
 * Menashop
 *
 * LICENSE
 *
 * This source file is subject to the license that is bundled
 * with this project in the file LICENSE.txt
 *
 * @category   Zend
 * @package    Admin_Model
 * @subpackage FormPriceRules
 * @copyright  Copyright (c) 2011 Menashop UA Inc. (http://www.menashop.com.ua)
 * @license    LICENSE.txt
 * @version    1.0.0
 * @since      File available since Release 1.0.0
 */

/**
 * The form for price rules
 * 
 * @category   Zend
 * @package    Admin_Model
 * @subpackage FormPriceRules
 * @copyright  Copyright (c) 2011 Menashop UA Inc. (http://www.menashop.com.ua)
 * @license    LICENSE.txt
 */
class Admin_Model_FormPriceRules extends Zend_Form
{

    public function init()
    {
        $this->setMethod('post');

        $page = new Zend_Form_Element_Text('page');
        $page->removeDecorator('label');
        $page->removeDecorator('htmlTag');
        $page->removeDecorator('Errors');
        $this->addElement($page);

        $rows = new Zend_Form_Element_Select('rows');
        $rowsOnPage = array('20', '50', '100');
        foreach ($rowsOnPage as $value) {
            $rows->addMultiOption($value, $value);
        }
        $rows->removeDecorator('label');
        $rows->removeDecorator('htmlTag');
        $rows->removeDecorator('Errors');
        $this->addElement($rows);

        $recordsCount = new Zend_Form_Element_Text('records_count');
        $this->addElement($recordsCount);

        $pagesCount = new Zend_Form_Element_Text('pages_count');
        $this->addElement($pagesCount);

        $sort = new Zend_Form_Element_Hidden('sort');
        $sort->removeDecorator('label');
        $sort->removeDecorator('htmlTag');
        $sort->removeDecorator('Errors');
        $this->addElement($sort);

        $direction = new Zend_Form_Element_Hidden('direction');
        $direction->removeDecorator('label');
        $direction->removeDecorator('htmlTag');
        $direction->removeDecorator('Errors');
        $this->addElement($direction);

        $categoryName = new Zend_Form_Element_Text('category_name');
        $categoryName->removeDecorator('label');
        $categoryName->removeDecorator('htmlTag');
        $categoryName->removeDecorator('Errors');
        $categoryName->setAttrib('class', 'text-field');
        $this->addElement($categoryName);

        $manufacturerName = new Zend_Form_Element_Text('manufacturer_name');
        $manufacturerName->removeDecorator('label');
        $manufacturerName->removeDecorator('htmlTag');
        $manufacturerName->removeDecorator('Errors');
        $manufacturerName->setAttrib('class', 'text-field');
        $this->addElement($manufacturerName);

        $productName = new Zend_Form_Element_Text('product_name');
        $productName->removeDecorator('label');
        $productName->removeDecorator('htmlTag');
        $productName->removeDecorator('Errors');
        $productName->setAttrib('class', 'text-field');
        $this->addElement($productName);

        $markupFrom = new Zend_Form_Element_Text('markup_from');
        $markupFrom->removeDecorator('label');
        $markupFrom->removeDecorator('htmlTag');
        $markupFrom->removeDecorator('Errors');
        $markupFrom->setAttrib('class', 'number-field');
        $this->addElement($markupFrom);

        $markupTo = new Zend_Form_Element_Text('markup_to');
        $markupTo->removeDecorator('label');
        $markupTo->removeDecorator('htmlTag');
        $markupTo->removeDecorator('Errors');
        $markupTo->setAttrib('class', 'number-field');
        $this->addElement($markupTo);

        $priorityFrom = new Zend_Form_Element_Text('priority_from');
        $priorityFrom->removeDecorator('label');
        $priorityFrom->removeDecorator('htmlTag');
        $priorityFrom->removeDecorator('Errors');
        $priorityFrom->setAttrib('class', 'number-field');
        $this->addElement($priorityFrom);

        $priorityTo = new Zend_Form_Element_Text('priority_to');
        $priorityTo->removeDecorator('label');
        $priorityTo->removeDecorator('htmlTag');
        $priorityTo->removeDecorator('Errors');
        $priorityTo->setAttrib('class', 'number-field');
        $this->addElement($priorityTo);

        $updatedFrom = new Zend_Form_Element_Text('updated_from');
        $updatedFrom->removeDecorator('label');
        $updatedFrom->removeDecorator('htmlTag');
        $updatedFrom->removeDecorator('Errors');
        $updatedFrom->setAttrib('class', 'date-field');
        $this->addElement($updatedFrom);

        $updatedTo = new Zend_Form_Element_Text('updated_to');
        $updatedTo->removeDecorator('label');
        $updatedTo->removeDecorator('htmlTag');
        $updatedTo->removeDecorator('Errors');
        $updatedTo->setAttrib('class', 'date-field');
        $this->addElement($updatedTo);

        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Search');
        $submit->setAttrib('id', 'search-button');
        $submit->removeDecorator('DtDdWrapper');
        $this->addElement($submit);

        $this->setDecorators(array(array('ViewScript', array('viewScript' => '_form_price_rules.phtml'))));
    }

}

